﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using WcfService.DTO;

namespace WcfService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService" in both code and config file together.
    [ServiceContract]
    [XmlSerializerFormat]
    public interface IService
    {
        //Rss
        [OperationContract]
        [WebGet(UriTemplate = "dsRss/getAll", ResponseFormat = WebMessageFormat.Xml)]
        RssDTO[] getRssAll();

        [OperationContract]
        [WebGet(UriTemplate = "dsRss/{ma}", ResponseFormat = WebMessageFormat.Xml)]
        RssDTO[] getRssUser(String ma);

        //NguoiDung
        [OperationContract]
        [WebGet(UriTemplate = "user/getAll", ResponseFormat = WebMessageFormat.Xml)]
        NguoiDungDTO[] getUsersAll();

        [OperationContract]
        [WebGet(UriTemplate = "user/getUser/{ma}", ResponseFormat = WebMessageFormat.Xml)]
        NguoiDungDTO[] getUser(string ma);

        [OperationContract]
        [WebInvoke(UriTemplate = "user", Method = "POST")]
        void insertUser(NguoiDungDTO info);

        [OperationContract]
        [WebInvoke(Method = "DELETE", UriTemplate = "user/deleteUser/{ma}/{tinhTrang}", ResponseFormat = WebMessageFormat.Xml)]
        void deleteUser(string ma, string tinhTrang);

        [OperationContract]
        [WebInvoke(Method = "DELETE", UriTemplate = "user/delete/{ma}", ResponseFormat = WebMessageFormat.Xml)]
        void delete(string ma);

        [OperationContract]
        [WebInvoke(Method = "PUT", UriTemplate = "user")]
        void updateUser(NguoiDungDTO info);

        //BinhLuan
        [OperationContract]
        [WebGet(UriTemplate = "comment/getAll", ResponseFormat = WebMessageFormat.Xml)]
        BinhLuanDTO[] getCommentsAll();

        [OperationContract]
        [WebGet(UriTemplate = "comment/{matin}", ResponseFormat = WebMessageFormat.Xml)]
        BinhLuanDTO[] getComment(string matin);

        //TinMuaBan
        [OperationContract]
        [WebGet(UriTemplate = "news/getAll", ResponseFormat = WebMessageFormat.Xml)]
        TinTucDTO[] getNewsAll();

        [OperationContract]
        [WebGet(UriTemplate = "news/{matin}", ResponseFormat = WebMessageFormat.Xml)]
        TinTucDTO[] getNews(string matin);

        [OperationContract]
        void DoWork();
    }
}
